const {
  DataTypes
} = require('sequelize');
module.exports = sequelize => {
  const attributes = {
    idea_id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: "意见id",
      field: "idea_id"
    },
    user_id: {
      type: DataTypes.STRING(255),
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "用户id",
      field: "user_id",
      references: {
        key: "user_id",
        model: "user_model"
      }
    },
    idea_info: {
      type: DataTypes.STRING(300),
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "意见内容",
      field: "idea_info"
    },
    idea_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "意见提交时间",
      field: "idea_time"
    }
  };
  const options = {
    tableName: "idea",
    comment: "",
    indexes: [{
      name: "user_id",
      unique: false,
      type: "BTREE",
      fields: ["user_id"]
    }]
  };
  const IdeaModel = sequelize.define("idea_model", attributes, options);
  return IdeaModel;
};